import { injectScript } from 'requester-utils/fe/extension';
import { ChromePortStream } from 'requester-utils/fe/extension';
import { MessageObserver, PostMessageStream } from 'requester-utils/fe/transfer';

injectScript('src/inject.js').then(() => {
    const observer = MessageObserver.from(PostMessageStream);
    observer.subscribe('fetch', async params => {
        return await MessageObserver.from(new ChromePortStream(chrome.runtime.connect())).publish('fetch', params);
    });
});